<?php
class Dmf_Form_Helper_Upload extends Dmf_Form_Helper
{
    public function execute( $value )
    {
        if ( $value['tmp_name'] == null && $value['name'] == null ) return;
        
        if ( ! move_uploaded_file( $value['tmp_name'], str_replace( '%file%', $value['name'], $this->_value ) ) )
        {
            $this->_element->addError( 'fail', 'Uploading file failed' );
            
            return false;
        }
    }
}